home *** CD-ROM | disk | FTP | other *** search
- Path: keats.ugrad.cs.ubc.ca!not-for-mail
- From: c2a192@ugrad.cs.ubc.ca (Kazimir Kylheku)
- Newsgroups: comp.lang.c
- Subject: Re: string and NULL :ques
- Date: 20 Feb 1996 11:04:43 -0800
- Organization: Computer Science, University of B.C., Vancouver, B.C., Canada
- Message-ID: <4gd60bINNk22@keats.ugrad.cs.ubc.ca>
- References: <4g5flf$bil@gail.ripco.com>
- NNTP-Posting-Host: keats.ugrad.cs.ubc.ca
-
- In article <4g5flf$bil@gail.ripco.com>,
- Martin Ambuhl <mambuhl@ripco.com> wrote:
- >If you want to work on a char array which does not contain a null
- >character, how do you propose to tell the library functions where it
- >ends?
- >
- >One possible result of using the library functions on such a char array
- >is a segfault. On M$BrokenOS, the results are completely unpredictable,
- >since there is no protection against access (including writing) of
- >regions containing other data, your program, or even portions of the OS.
-
- Well, even under a good OS, you still can only detect overruns to the accuracy
- of a page size. You can still hose your heap, which contains valid addresses
- well beyond the bounds of most allocated blocks. In static storage, it is
- possible to easily overrun your accesses to one static variable so that you
- clobber an adjacent one (or two, or three...). The protection mechanisms
- certainly do a great job of catching such errors, and specialized tools which
- rely on memory management hardware to some extent (Purify, ElectricFence) do
- much of the other half.
- --
-
-